<?php 
$sql_getType = "SELECT DISTINCT products_options_values.products_options_values_name FROM ". TABLE_PRODUCTS ." INNER JOIN ". TABLE_PRODUCTS_ATTRIBUTES ." ON products.products_id = products_attributes.products_id INNER JOIN ". TABLE_PRODUCTS_DESCRIPTION ." ON products.products_id = products_description.products_id INNER JOIN ". TABLE_PRODUCTS_OPTIONS ." ON products_attributes.options_id = products_options.products_options_id INNER JOIN ". TABLE_PRODUCTS_OPTIONS_VALUES ." ON products_attributes.options_values_id = products_options_values.products_options_values_id CROSS JOIN ". TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS ." WHERE products_options.products_options_name = 'Sale' and products_options_values.language_id = '" . (int) $languages_id . "'";
$typeResult = tep_db_query($sql_getType);
$typeResult1 = tep_db_query($sql_getType);
?>

<div class="content">
    <div class="content-top"><img src="pub/images/center01.gif" width="963" height="395" />
    </div>
    <div class="content-bottom">
        <table class="categories">
        <tr class="firstrow">
      <?php  
      $firstcnt = 0;
      if (tep_db_num_rows($typeResult) > 0) {
    while ($typeIndex = tep_db_fetch_array($typeResult)) {
    	$firstcnt ++;
    	echo '<td><a href="index_products.php?type='.$typeIndex['products_options_values_name'].'" id="indexpic-'.$firstcnt.'"><div class="picture"></div></a></td>';
	    }
	}
	?>
            </tr>
            <tr class="secondrow">
      <?php  
      if (tep_db_num_rows($typeResult1) > 0) {
    while ($typeIndex = tep_db_fetch_array($typeResult1)) {
    	echo '<td><a href="index_products.php?type='.$typeIndex['products_options_values_name'].'">'.$typeIndex['products_options_values_name'].'</a></td>';
	    }
	}
	?>      </tr>
        </table>
    </div>
</div>
